<div class="sidebar" id="sidebar">
      <el-menu class="el-menu-vertical-demo" theme="light" unique-opened router>
          <template v-for="item in items">
              <template v-if="item.subs">
                  <el-submenu :index="item.index">
                      <template slot="title"><i :class="item.icon"></i>{{ item.title }}</template>
                      <el-menu-item v-for="(subItem,i) in item.subs" :key="i" :index="subItem.index" @click="router(subItem.index)">{{ subItem.title }}</el-menu-item>
                  </el-submenu>
              </template>
              <template v-else>
                  <el-menu-item :index="item.index" @click="router(item.index)">
                      <i :class="item.icon"></i>{{ item.title }}
                  </el-menu-item>
              </template>
          </template>
      </el-menu>
</div>
<link rel="stylesheet" href="https://unpkg.com/element-ui@2.4.11/lib/theme-chalk/index.css">
<link rel="stylesheet" href="${basePath}/css/common.css">
<script src="https://unpkg.com/vue@2.5.22/dist/vue.js"></script>
<script src="https://unpkg.com/element-ui@2.4.11/lib/index.js"></script>
<script src="https://unpkg.com/axios@0.18.0/dist/axios.min.js"></script>
<script>
  new Vue({
    el: '#sidebar',
    data: function() {
  	  return {
            items: [
                {
                    icon: 'el-icon-setting',
                    index: '/project/list',
                    title: '项目管理'
                },
                {
                    icon: 'el-icon-setting',
                    index: '/machine/list',
                    title: '机器管理'
                }
            ]
        }
    },
    methods:{
    	router:function(url){
    		window.location.href = url;
    	}
    }
  })
</script>